import SwiftUI

struct PhotoCard: View {
    var image: Image
    var title: String
    var subtitle: String? = nil
    var onTap: (() -> Void)? = nil
    
    var body: some View {
        VStack(alignment: .leading, spacing: 8) {
            image
                .resizable()
                .aspectRatio(1, contentMode: .fill)
                .frame(height: 120)
                .clipped()
                .cornerRadius(12)
            Text(title)
                .font(.headline)
                .lineLimit(1)
            if let subtitle = subtitle {
                Text(subtitle)
                    .font(.subheadline)
                    .foregroundColor(.secondary)
                    .lineLimit(1)
            }
        }
        .padding(8)
        .background(Color(.systemBackground))
        .cornerRadius(16)
        .shadow(color: Color.black.opacity(0.06), radius: 4, x: 0, y: 2)
        .onTapGesture { onTap?() }
    }
}

#Preview {
    PhotoCard(image: Image(systemName: "photo"), title: "照片标题", subtitle: "描述")
        .padding()
        .frame(width: 160)
} 